Binary Translation (BT) is a technique that may be utilized to achieve instruction set architecture (ISA) compatibility of a binary without recompiling, increased performance through dynamic optimization, enforcement of security policy during execution, etc. A binary translator may generate translations from native code (e.g., a programming language used by a programmer to construct a program) and execute these translations instead of the native code. Otherwise the native code would need to be interpreted (e.g., translated line-by-line during execution), which may slow down the speed of data processing. While BT increases performance, it is important for BT systems to be faithful to how the original program is designed to execute. Therefore, BT systems strive to produce the same output as the native code. Translating native code into binary may also slow down system performance, so if native code may be executed more than once it may be beneficial to store a copy of the binary translation in a translation memory or “cache” so that the binary may be executed repeatedly without having to translate the native code each time.
Maintaining binary translations in a translation cache for frequently accessed translations is an effective technique to enhance the performance of a BT system. However, a mechanism is required to invalidate or update binary translations in the translation cache as the corresponding native code is modified (e.g., sometimes as the native code modifies itself in self-modifying or cross-modifying code). The code modifications may be caused by, for example, version updates and/or corrections (e.g., patches) to the code, code obfuscation (e.g., the inclusion of needless or roundabout references in the code that may change during execution to protect the code against hacking, reverse engineering, etc.), the unpacking of code, just-in-time compilation of code, etc. Whatever the reason, once native code is modified any binary translations that originated from the native code should be invalidated and updated as soon as native code changes. Moreover, a binary update operation may also involve timely notifications to any processing threads running the code to prevent the execution of binary translations no longer consistent with the native code.
Although the following Detailed Description will proceed with reference being made to illustrative embodiments, many alternatives, modifications and variations thereof will be apparent to those skilled in the art.